package com.umfwechat.util;

import java.util.Random;
/**
 * 随机生成6位验证码,随机生成16位字符串
 * @author zhangxichao
 *
 */


public class RandomCode {
	 public String getSix(){  
	        Random rad=new Random();  
	          
	        String result  = rad.nextInt(1000000) +"";  
	          
	        if(result.length()!=6){  
	            return getSix();  
	        }  
	        return result;  
	    }
	 public String getTwo(){  
	        Random rad=new Random();  
	          
	        String result  = rad.nextInt(100) +"";  
	          
	        if(result.length()!=2){  
	            return getTwo();  
	        }  
	        return result;  
	    }

	 public String getSixTeen(){
		 
		 Random rad=new Random();         	
	        String result1  = rad.nextInt(100000000) +""; 
	        String result2  = rad.nextInt(100000000) +"";
	        if(result1.length()!=8){  
	            return getSix();  
	        } 
	        if(result2.length()!=8){  
	            return getSix();  
	        } 
	        String result = result1+result2;
	        
	        return result;  
	 }
}
